package com.rmkj.trade.match.test;

import com.rmkj.trade.match.core.MatchTradeConstants;
import com.rmkj.trade.match.core.Order;

import java.util.Random;

/**
 * Created by Administrator on 2019/1/8.
 */
public class RandomOrder {

	private final static Random random = new Random();

	private final static String[] owners = new String[]{"A", "B", "C", "D"};

	static Order random(String code){
		return random(code, 4, 2, 0);
	}

	static Order random(String code, double basePrice){
		return random(code, 4, 2, basePrice);
	}

	static Order random(String code, int priceDigit, int pricePrecision, double basePrice){
		Order order = new Order(random.nextInt(2)
				, owners[random.nextInt(4)]
				, code
				, basePrice + (random.nextInt(2) == 0 ? 1 : -1 ) * (random.nextInt(new Double(Math.pow(10, priceDigit)).intValue()-1)+1)/Math.pow(10, pricePrecision)+""
				, random.nextInt(1000)+1.0);
		return order;
	}
}
